package cate.game.pvp.eliterace.simulator;

import cate.game.pvp.eliterace.timer.EliteRaceTimerTask.Settings;

import java.util.List;
import java.util.Objects;

public class BothEliteRaceSimulatorSelector implements EliteRaceSimulatorSelector {

    private final List<EliteRaceSimulator> simulators;

    public BothEliteRaceSimulatorSelector(List<EliteRaceSimulator> simulators) {
        Objects.requireNonNull(simulators);
        this.simulators = Objects.requireNonNull(simulators);
    }

    @Override
    public EliteRaceSimulator select(Settings settings) {
        return this.simulators.stream()
                .filter(simulator -> simulator.isMatch(settings))
                .findFirst()
                .orElse(null);
    }
}
